Electron Forge
  • Getting Started
  • Importing an Existing Project
  • CLI
  • Core Concepts
    • Why Electron Forge?
    • Build Lifecycle
  • Configuration
    • Configuration Overview
    • TypeScript Setup
    • Plugins
      • Webpack Plugin
      • Vite Plugin
      • Electronegativity Plugin
      • Auto Unpack Native Modules Plugin
      • Local Electron Plugin
      • Fuses Plugin
    • Makers
      • AppX
      • deb
      • DMG
      • Flatpak
      • pkg
      • RPM
      • Snapcraft
      • Squirrel.Windows
      • WiX MSI
      • ZIP
    • Publishers
      • Bitbucket
      • Electron Release Server
      • GitHub
      • Google Cloud Storage
      • Nucleus
      • S3
      • Snapcraft
    • Hooks
  • Built-in Templates
    • Webpack
    • Webpack + Typescript
    • Vite
    • Vite + TypeScript
  • Guides
    • Code Signing
      • Signing a Windows app
      • Signing a macOS app
    • Custom App Icons
    • Framework Integration
      • React
      • React with TypeScript
      • Vue 3
    • Developing with WSL
  • Advanced
    • Auto Update
    • Debugging
    • Extending Electron Forge
      • Writing Plugins
      • Writing Templates
      • Writing Makers
      • Writing Publishers
    • API Docs
Powered by GitBook
On this page
  • Requirements
  • Installation
  • Usage
  • Mandatory metadata
  • Handling startup events
  • Spaces in the app name
  • Debugging

Was this helpful?

Edit on GitHub
  1. Configuration
  2. Makers

Squirrel.Windows

Create a Windows installer for your Electron app using Electron Forge.

PreviousSnapcraftNextWiX MSI

Last updated 21 days ago

Was this helpful?

The Squirrel.Windows target builds your application using the framework. It generates three files:

File
Description

{appName} Setup.exe

The main executable installer for your application

{appName}-full.nupkg

The NuGet package file used for updates

RELEASES

Metadata file used to check if an update is available

Squirrel.Windows is a no-prompt, no-hassle, no-admin method of installing Windows applications, and is therefore the most user friendly you can get.

Requirements

You can only build the Squirrel.Windows target on a Windows machine or on a Linux machine with and installed.

Installation

npm install --save-dev @electron-forge/maker-squirrel

Usage

Add this module to the section of your :

forge.config.js
module.exports = {
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        certificateFile: './cert.pfx',
        certificatePassword: process.env.CERTIFICATE_PASSWORD
      }
    }
  ]
};

Mandatory metadata

In package.json

By default, the Squirrel.Windows maker fetches the author and description fields in the project's package.json file.

package.json
{
  // ...
  "author": "Alice and Bob",
  "description": "An example Electron app"
  // ...
}

In your Forge config

Alternatively, you can also override these values directly in your Squirrel.Windows maker config.

forge.config.js
module.exports = {
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        authors: 'Alice and Bob',
        description: 'An example Electron app'
      }
    }
  ]
};

Note that the Forge config field is "authors" while the package.json field is called "author".

Handling startup events

main.js
const { app } = require('electron');

// run this as early in the main process as possible
if (require('electron-squirrel-startup')) app.quit();

Spaces in the app name

Squirrel.Windows can behave unexpectedly when application names contain spaces. You can use the following setup in this case, which works well:

package.json
{
  // Hyphenated version
  "name": "app-name",
  // The app name with spaces (will be shown to your users)
  "productName": "App Name",
  // ...
}
forge.config.ts
const config: ForgeConfig = {
  makers: [
    new MakerSquirrel({
      // CamelCase version without spaces
      name: "AppName",
      // ...
    }),
  ],
  // ...
}

Additionally, you'll need to set the App User Model ID from your main process like this:

main.ts
app.setAppUserModelId("com.squirrel.AppName.AppName");

Squirrel.Windows will use the productName from your package.json for any user-facing strings and for the name of your Setup.exe.

It will use the camel-cased name from the MakerSquirrel config for the NuGet package name. NuGet package names cannot contain spaces.

Debugging

For advanced debug logging for this maker, add the DEBUG=electron-windows-installer* environment variable.

The Squirrel.Windows maker inherits all of its config options from the module, except for appDirectory and outputDirectory, which are set by the maker.

Complete configuration options are documented in the types.

Squirrel.Windows requires mandatory package metadata to satisfy the manifest format. There are two ways to specify this information in Electron Forge.

When first running your app, updating it, and uninstalling it, Squirrel.Windows will spawn your app an additional time with some special arguments. You can read more about these arguments on the README.

The easiest way to handle these arguments and stop your app launching multiple times during these events is to use the module as one of the first things your app does.

Squirrel.Windows
mono
wine
makers
Forge configuration
electron-winstaller
MakerSquirrelConfig
.nuspec
electron-winstaller
electron-squirrel-startup